/**
 * Created with Intellij IDEA.
 * Description;
 * User:TQ02
 * Data:2024-03-26
 * Time:16:56
 * Text：746. 使用最小花费爬楼梯
 */
public class Text4 {
    public int minCostClimbingStairs(int[] cost) {
        int[] dp=new int[cost.length+1];
        for(int i=1;i<=cost.length;i++){
            if(i==1){
                dp[i]=cost[i-1];
            }else{
                dp[i]=Math.min(dp[i-1],dp[i-2])+cost[i-1];
            }
        }
        return Math.min(dp[cost.length],dp[cost.length-1]);
    }

    public static void main(String[] args) {
        Text4 t1=new Text4();
        int[] array={10,0};
        System.out.println(t1.minCostClimbingStairs(array));
        ;
    }
}
